﻿using System;
using System.Linq;
using Solution.BusinessObject;

namespace Solution.Controls
{
    public partial class AuthorDetail : System.Web.UI.UserControl
    {
        private int _albumId;
        public Author Author { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Author == null)
            {
                if (Request["abl"] != null)
                {
                    _albumId = Convert.ToInt32(Request["abl"]);
                }

                if (_albumId <= 0)
                {
                    return;
                }

                var album = CommonBO.MasterEDM.Contents.FirstOrDefault(t => t.Id == _albumId);

                if (album == null)
                {
                    return;
                }

                Author = album.Author;
            }

            imgAuthorThumb.ImageUrl = Author.Thumb;
            lblName.Text = Author.Name;
            lblEmail.Text = Author.Title;
        }
    }
}